"""This is module that get report from file or from email"""
__version__ = "$Revision: 68852 $"
# $Source$

import re

class enum_report_get_method(object):
    """From where we get report file"""
    EMAIL = "email"
    FILE = "file"
    SERVER = "server"

class Report(list):
    """This class gets report from email, file, or server connection"""
    def __init__(self, get_method=enum_report_get_method.FILE, **kwargs):
        if (get_method==enum_report_get_method.FILE):
            try:
                f = open(kwargs['file_name'], 'r')
                for line in f:
                    self.append(re.sub("\s+" , " ", line.strip("\n\r\t").lstrip()))
                self.append("")
                self.append("")
                self.append("--==EOF==--")
                self = tuple(self)
            except IOError:
                pass



if __name__=="__main__":
    r = Report(enum_report_get_method.FILE, file_name="tests/Blood035.rep")
    for i in r:
        print i
